/***************************************************************************
 *   Copyleft 2006-2007 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __POINTSSET_H__
#define __POINTSSET_H__

#include "./Object3D.h"

#define POINT_BUFFER		30

class PointsSet: public Object3D {
public:
	enum SELECTION_TYPE {
		NO_SELECTION = 0,
		TEMP_SELECTION,
		PERS_SELECTION
	};
protected:
	struct PointPair {
		Point4D mPoint;
		SELECTION_TYPE mSelected;
	};
	cInt mReallocCnt;
	cInt mNrOfPoints;
	PointPair* mPoints;
	cWinColor mLastRenderedColor;
	cBool mDisplayPointsCords;

	cVoid Realloc();
	cVoid Render(Renderer& renderer, Matrix4D& matrix, ProjectionPlane& plane, cWinColor color, PointPair *tab, cInt tabSize);
public:
    /**************************************************************
    * Constructors                                                *
    ***************************************************************/
    PointsSet();
	PointsSet(const PointsSet& point);
    virtual ~PointsSet(); 
        
    /**************************************************************
    * Operators                                                   *
    ***************************************************************/
	PointsSet& operator=(const PointsSet& point);

    /**************************************************************
    * Other helpful functions                                     *
    ***************************************************************/
	virtual cVoid AddPoint(Point4D point);
	virtual cVoid AddPoint(Point4D point, cUShort selected);
	virtual cVoid ReplacePoint(const Point4D& point, cInt iIndex);
	virtual cVoid RemovePoint(cInt i);
	Point4D GetPoint(cInt i);
	cInt GetNrOfPoints();
	cVoid SelectPoint(cInt iIndex, SELECTION_TYPE eSelected);
	SELECTION_TYPE SelectPoint(cInt iIndex, cBool bSelect);
	cVoid DeselectPoints();
	cVoid SwitchDisplayPoints();
	cBool ArePointsCordsVisible();


	virtual cVoid Render(Renderer& renderer, Matrix4D& matrix, ProjectionPlane& plane);
	virtual cVoid Render(Renderer& renderer, Matrix4D& matrix, ProjectionPlane& plane, cWinColor color);
	virtual cVoid Transform(Matrix4D& matrix);
	virtual cVoid Transform(Matrix4D& matrix, cInt iIndex);
	virtual cVoid Transform(Matrix4D& matrix, cBool bRemember);
	cVoid DisplayInfo(Renderer& renderer, Matrix4D& matrix, ProjectionPlane& plane);
	virtual cVoid DisplayInfo(Renderer& renderer);
	virtual cChar* GetName();
};                                                                 

#endif // __POINTSSET_H__